{
 "metadata": {
  "name": "05-Autocollimator"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Ejemplo de un sistema mas complejo que involucra superficies reflectivas"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from pyoptools.all import *"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "BS=BeamSplitingCube(size=25,reflectivity=.5,material=schott[\"BK7\"])\n",
      "L=Edmund.get(\"32494\")\n",
      "M1=Component(surflist=[(Plane(shape=Rectangular((25,25)) ,reflectivity=0.5),(0,0,0),(0,0,0))])\n",
      "M2=Component(surflist=[(Plane(shape=Rectangular((25,25)) ,reflectivity=1),(0,0,0),(0,0,0))])\n",
      "\n",
      "C=CCD()\n",
      "\n",
      "#Nota, hay problemas si existe una cavidad resonante\n",
      "S=System(complist=[(C,(20,0,20),(0,pi/2,0)),(BS,(0,0,20),(0,0,0)),(L,(0,0,156.),(0,-pi,0)),(M1,(0,0,170),(0,0,0)),(M2,(0,0,570),(.005,0,0))],n=1.)\n",
      "R=point_source_c(span=(0.06,0.06),wavelength=.65)\n",
      "\n",
      "\n",
      "S.ray_add(R)\n",
      "S.propagate()\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "plot3D(S,center=(0,0,300), size=(600,100),scale=2,rot=[(0,0,-3*pi/8),(0,3*pi/8,0)])"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "spot_diagram(C)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "#Ejercicio \n",
      "Ajustar el montaje del colimador, para que forme imagen puntual cuando la superficie lejana sea esferica y no plana. Remplace \n",
      "el plano por una superficie esferica con un radio de curvatura de 1000 mm"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "BS=BeamSplitingCube(size=25,reflectivity=.5,material=schott[\"BK7\"])\n",
      "L=Edmund.get(\"32494\")\n",
      "M2=Component(surflist=[(Spherical(shape=Circular(radius=20),curvature=1./1000,reflectivity=1),(0,0,0),(0,0,0))])\n",
      "\n",
      "C=CCD()\n",
      "\n",
      "#Nota, hay problemas si existe una cavidad resonante\n",
      "S=System(complist=[(C,(20,0,20),(0,pi/2,0)),(BS,(0,0,20),(0,0,0)),(L,(0,0,176.5),(0,-pi,0)),(M2,(0,0,570),(.0,0,0))],n=1.)\n",
      "R=point_source_c(span=(0.06,0.06),wavelength=.65)\n",
      "\n",
      "\n",
      "S.ray_add(R)\n",
      "S.propagate()\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "plot3D(S,center=(0,0,300), size=(600,100),scale=2,rot=[(0,0,-3*pi/8),(0,3*pi/8,0)])"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "spot_diagram(C)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "Spherical?\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}